package com.demo.bmsconsole;

import android.content.Context;

public class Config
{
	private Context mCtx;

	public static int InitTimeout = 0;
	public static int CellCount = 0;
	public static double UVSet = 0;
	public static double UVClear = 0;
	public static double OVSet = 0;
	public static double OVClear = 0;
	public static int CellCheckDuration = 0;
	
	Config(Context ctx) throws AssertionError
	{
		mCtx = ctx;
	    initialize();
	}

	public void initialize() throws AssertionError
	{
		InitTimeout = Integer.parseInt(BMSdb.getConfigValue(BMSdb.CFG_INIT_TIMEOUT));
		assert (InitTimeout != 0) : "InitTimeout!";

		CellCount = Integer.parseInt(BMSdb.getConfigValue(BMSdb.CFG_CELL_COUNT));
		assert (InitTimeout != 0) : "BatteryCount!";

		UVSet = Double.parseDouble(BMSdb.getConfigValue(BMSdb.CFG_UV_THRESH_SET));
		assert (UVSet != 0) : "UVSet!";
		
		UVClear = Double.parseDouble(BMSdb.getConfigValue(BMSdb.CFG_UV_THRESH_CLEAR));
		assert (UVClear != 0) : "UVClear!";
	
		OVSet = Double.parseDouble(BMSdb.getConfigValue(BMSdb.CFG_OV_THRESH_SET));
		assert (OVSet != 0) : "OVSet!";

		OVClear = Double.parseDouble(BMSdb.getConfigValue(BMSdb.CFG_OV_THRESH_CLEAR));
		assert (OVClear != 0) : "OVClear!";

		CellCheckDuration = Integer.parseInt(BMSdb.getConfigValue(BMSdb.CFG_CELL_CHECK_DURATION));
		assert (CellCheckDuration != 0) : "CellCheckDuration!";
	}


}